/**
 * @author:linjiye
 * @date: 2024/01/13
 * @desc: 登录模块接口定义
 **/

import {createApi} from "@reduxjs/toolkit/query/react";
import useBaseQuery from "@/hooks/useBaseQuery";

export const videoPublishApi = createApi({
    reducerPath:'videoPublishApi',
    baseQuery:useBaseQuery('mm'),
    endpoints(build) {
        return {
          getTaskList:build.query({
            query:(data:any) => {
              return {
                url: 'mmVideoPub/list',
                method:"get",
                params:data,
                openErrMessage: true
              }
            },
          }),
          getTitle:build.mutation({
            query:(data:any) => {
              return {
                url: 'mmVideoPub/genTitleByVideoPath',
                method:"get",
                params:data,
                openErrMessage: false
              }
            },
          }),
          videoUpload:build.mutation({
            query:(data:any) => {
              return {
                url: 'mmVideoPub/upload',
                method:"post",
                body:data,
                openErrMessage: true
              }
            },
          }),
          generatePubSchema:build.mutation({
            query:(data:any) => {
              return {
                url: 'mmVideoPub/generatePubSchema',
                method:"post",
                body:data,
                openErrMessage: true
              }
            },
          }),
          getAccountAll:build.mutation({
            query:(data:any) => {
              return {
                url: 'mmAccount/getAccountAll',
                method:"get",
                params:data,
                openErrMessage: true
              }
            },
          }),
          videoPubAdd:build.mutation({
            query:(data:any) => {
              return {
                url: 'mmVideoPub/add',
                method:"post",
                body:data,
                openErrMessage: true
              }
            },
          }),
        }
    }
});

export const {
    useGetTaskListQuery,
    useGetTitleMutation,
    useVideoUploadMutation,
    useGeneratePubSchemaMutation,
    useGetAccountAllMutation,
    useVideoPubAddMutation,
} = videoPublishApi;
